﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;

namespace FireZone.OperationLogger
{
    internal class OperationLoggerItem : INotifyPropertyChanged
    {
        private string _displayName;
        private int _progressPercent;
        private bool _hasProgess;

        public string DisplayName 
        { 
            get
            {
                return _displayName;
            }
            set
            {
                if(!string.Equals(_displayName, value, StringComparison.Ordinal))
                {
                    _displayName = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "DisplayName");
                }
            }
        }

        public string DisplayMessage 
        { 
            get
            {
                return _displayMessage;
            }
            set
            {
                if(!string.Equals(_displayMessage, value, StringComparison.Ordinal))
                {
                    _displayMessage = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "DisplayMessage");
                }
            }
        }

        public bool IsFailed 
        { 
            get
            {
                return _isFailed;
            }
            set
            {
                if(_isFailed != value)
                {
                    _isFailed = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "IsFailed");
                }
            }
        }

        public int ProgressPercent 
        { 
            get
            {
                return _progressPercent;
            }
            set
            {
                if(_progressPercent != value)
                {
                    _progressPercent = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "ProgressPercent");
                }
            }
        }
        public bool HasProgress 
        { 
            get
            {
                return _hasProgess;
            }
            set
            {
                if(_hasProgess != value)
                {
                    _hasProgess = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "HasProgress");
                }
            }
        }

        public bool IsQueued 
        { 
            get
            {
                return _isQueued;
            }
            set
            {
                if(_isQueued != value)
                {
                    _isQueued = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "IsQueued");
                }
            }
        }

        public OperationType? OperationType 
        { 
            get
            {
                return _operationType;
            }
            set
            {
                if(_operationType != value)
                {
                    _operationType = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "OperationType");
                }
            }
        }

        public bool IsCanceled
        {
            get
            {
                return _isCanceled;
            }
            set
            {
                if(_isCanceled != value)
                {
                    _isCanceled = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "IsCanceled");
                }
            }
        }

        public bool IsCompleted 
        { 
            get
            {
                return _isCompleted;
            }
            set
            {
                if(_isCompleted != value)
                {
                    _isCompleted = value;
                    PropertyChanged.NotifyPropertyChangedAsync(this, "IsCompleted");
                }
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        private string _displayMessage;
        private bool _isQueued;
        private bool _isCanceled;
        private OperationLogger.OperationType? _operationType;
        private bool _isCompleted;
        private bool _isFailed;

        #endregion
    }
}
